<template>
	<om-page :title="pageTitle">
		<view class="page__bd" style="margin-top:10rpx;">
			<uni-list>
				<view v-for="(item, index) in commonData.datas" :key="index">
					<uni-list-item 
					:avatar="index + 1" 
					avatarBgColor="olive light" 
					avatarSize="lg" 
					@click="infoTab(item)">
						<view>
							<view>{{ item.startDate == (item.backEndDate || item.endDate) ? item.startDate : item.startDate + ' - ' + (item.backEndDate || item.endDate) }}</view>
							<view class="text-sm text-cut">{{ item.reason }}</view>
						</view>
						<view slot="footer">
							<view class="text-sm">{{ item.leaveCatName }}</view>
						</view>
					</uni-list-item>
				</view>
			</uni-list>
		</view>
		<tui-loadmore :visible="commonData.loadding"></tui-loadmore>
		<tui-nomore :visible="!commonData.pullUpOn"></tui-nomore>
		<tui-scroll-top :scrollTop="scrollTop" style="background: rgba(124, 174, 255, 0.5)"></tui-scroll-top>
	</om-page>
</template>

<script>
import listLoad from '../../../static/js/listLoad.js';
const app = getApp();
export default {
	data() {
		return {
			scrollTop: 0,
			commonData: {},
			pageTitle:""
		};
	},
	methods: {
		infoTab(item) {
			this.om.getFormInfoByFileCode(item.code, item.busCode);
		}
	},
	onLoad(options) {
		let _that = this;
		this.pageTitle = options.title || '我的请假'
		uni.setNavigationBarTitle({
			title: this.pageTitle
		});
		listLoad.initData(this, 'wxAttend/getAskleaveList');
	},
	onPageScroll(e) {
		let _that = this;
		_that.scrollTop = e.scrollTop;
	},
	//页面相关事件处理函数--监听用户下拉动作
	onPullDownRefresh: function() {
		listLoad.pullDownRefresh(this);
	},

	// 页面上拉触底事件的处理函数
	onReachBottom: function() {
		listLoad.reachBottom(this);
	}
};
</script>

<style></style>
